// import axios from 'axios';
const util = {}

util.inOf = function (arr, targetArr) {
  let res = true
  arr.forEach((item) => {
    if (!targetArr.includes(item)) 
      res = false
        
  })
  return res
}

util.oneOf = function (ele, targetArr) {
  if (targetArr.includes(ele)) 
    return true
  else 
    return false
    
}


util.toDefaultPage = function (routers, name, route, next) {
  const len = routers.length
  let i = 0
  let notHandle = true
  while (i < len) {
    if (routers[i].name == name && routers[i].children && routers[i].redirect == undefined) {
      route.replace({
        name: routers[i].children[0].name,
      })
      notHandle = false
      next()
      break
    }
    i++
  }
  if (notHandle) 
    next()
    
}

util.fullscreenEvent = function (vm) {
  vm.$store.commit('initCachepage')
}



export default util
